package com.carol.lmsbe.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.carol.lmsbe.entity.Laboratory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 实验室Mapper接口
 */
@Mapper
public interface LaboratoryMapper extends BaseMapper<Laboratory> {
    
    /**
     * 根据负责人姓名查询实验室
     */
    @Select("SELECT * FROM laboratory WHERE manager_name = #{managerName}")
    Laboratory selectByManagerName(@Param("managerName") String managerName);
    
    /**
     * 查询所有启用的实验室
     */
    @Select("SELECT * FROM laboratory WHERE status = 1 ORDER BY name")
    List<Laboratory> selectAllActive();
}
